/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wakawakathistimeforafrica.ihm;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import wakawakathistimeforafrica.model.Client;
import wakawakathistimeforafrica.tools.ModelGenerator;
import wakawakathistimeforafrica.tools.ModelRequester;
import weka.core.Instance;
import weka.core.Instances;

/**
 *
 * @author Perrine
 */
public class MainForm extends javax.swing.JFrame {

    Client client;
    private Instances dataSet;
    
    /**
     * Creates new form MainForm
     */
    public MainForm(Instances dataSet) {
        initComponents();
        this.dataSet = dataSet;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        checking_status = new javax.swing.JComboBox();
        credit_history = new javax.swing.JComboBox();
        purpose = new javax.swing.JComboBox();
        saving_status = new javax.swing.JComboBox();
        employment = new javax.swing.JComboBox();
        personal_status = new javax.swing.JComboBox();
        other_parties = new javax.swing.JComboBox();
        lbl_checking_status = new javax.swing.JLabel();
        lbl_duration = new javax.swing.JLabel();
        lbl_credit_history = new javax.swing.JLabel();
        lbl_purpose = new javax.swing.JLabel();
        lbl_credit_amount = new javax.swing.JLabel();
        lbl_saving_status = new javax.swing.JLabel();
        lbl_employment = new javax.swing.JLabel();
        lbl_installment_commitment = new javax.swing.JLabel();
        lbl_personal_status = new javax.swing.JLabel();
        lbl_other_parties = new javax.swing.JLabel();
        duration = new javax.swing.JTextField();
        credit_amount = new javax.swing.JTextField();
        installment_commitment = new javax.swing.JTextField();
        lbl_age = new javax.swing.JLabel();
        lbl_existing_credits = new javax.swing.JLabel();
        lbl_residence_since = new javax.swing.JLabel();
        lbl_job = new javax.swing.JLabel();
        lbl_property_magnitude = new javax.swing.JLabel();
        lbl_num_dependents = new javax.swing.JLabel();
        own_telephone = new javax.swing.JComboBox();
        lbl_own_telephone = new javax.swing.JLabel();
        foreign_worker = new javax.swing.JComboBox();
        lbl_foreign_worker = new javax.swing.JLabel();
        job = new javax.swing.JComboBox();
        num_dependents = new javax.swing.JTextField();
        lbl_housing = new javax.swing.JLabel();
        lbl_other_payment_plans = new javax.swing.JLabel();
        other_payment_plants = new javax.swing.JComboBox();
        residence_since = new javax.swing.JTextField();
        property_magnitude = new javax.swing.JComboBox();
        age = new javax.swing.JTextField();
        housing = new javax.swing.JComboBox();
        existing_credits = new javax.swing.JTextField();
        btn_validate = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        checking_status.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "<0", "0<=X<200", ">=200", "no checking" }));

        credit_history.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "no credits/all paid", "all paid", "existing paid", "delayed previously", "critical/other existing credit" }));
        credit_history.setMinimumSize(new java.awt.Dimension(118, 20));

        purpose.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "new car", "used car", "furniture/equipment", "radio/tv", "domestic appliance", "repairs", "education", "vacation", "retraining", "business", "other" }));
        purpose.setMinimumSize(new java.awt.Dimension(118, 20));

        saving_status.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "<100", "100<=X<500", "500<=X<1000", ">=1000", "no known savings" }));

        employment.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "unemployed", "<1", "1<=X<4", "4<=X<7", ">=7" }));

        personal_status.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "male div/sep", "female div/dep/mar", "male single", "male mar/wid", "female single" }));

        other_parties.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "none", "co applicant", "guarantor" }));

        lbl_checking_status.setText("checking_status");

        lbl_duration.setText("duration");

        lbl_credit_history.setText("credit_history");

        lbl_purpose.setText("purpose");

        lbl_credit_amount.setText("credit_amount");

        lbl_saving_status.setText("saving_status");

        lbl_employment.setText("employment");

        lbl_installment_commitment.setText("installment_commitment");

        lbl_personal_status.setText("personal_status");

        lbl_other_parties.setText("other_parties");

        duration.setColumns(3);
        duration.setText("20");

        credit_amount.setColumns(5);
        credit_amount.setText("3000");
        credit_amount.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                credit_amountActionPerformed(evt);
            }
        });

        installment_commitment.setColumns(3);
        installment_commitment.setText("3");

        lbl_age.setText("age");

        lbl_existing_credits.setText("existing_credits");

        lbl_residence_since.setText("residence_since");

        lbl_job.setText("job");

        lbl_property_magnitude.setText("property_magnitude");

        lbl_num_dependents.setText("num_dependents");

        own_telephone.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "none", "yes" }));
        own_telephone.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                own_telephoneActionPerformed(evt);
            }
        });

        lbl_own_telephone.setText("own_telephone");

        foreign_worker.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "yes", "no" }));

        lbl_foreign_worker.setText("foreign_worker");

        job.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "unemp/unskilled non res", "unskilled resident", "skilled", "high qualif/self emp/mgmt" }));

        num_dependents.setColumns(3);
        num_dependents.setText("1");

        lbl_housing.setText("housing");

        lbl_other_payment_plans.setText("other_payment_plans");

        other_payment_plants.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "bank", "stores", "none" }));
        other_payment_plants.setSelectedIndex(2);
        other_payment_plants.setMinimumSize(new java.awt.Dimension(118, 20));

        residence_since.setColumns(3);
        residence_since.setText("3");

        property_magnitude.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "real estate", "life insurance", "car", "no known property" }));
        property_magnitude.setSelectedIndex(2);

        age.setColumns(3);
        age.setText("35");

        housing.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "rent", "own", "for free" }));
        housing.setSelectedIndex(1);

        existing_credits.setColumns(3);
        existing_credits.setText("1");

        btn_validate.setText("Validate");
        btn_validate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_validateActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(lbl_credit_amount)
                            .addGap(72, 72, 72)
                            .addComponent(credit_amount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(lbl_saving_status)
                            .addGap(2, 2, 2)
                            .addComponent(saving_status, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lbl_other_parties)
                            .addComponent(lbl_employment)
                            .addComponent(lbl_installment_commitment)
                            .addComponent(lbl_personal_status))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(personal_status, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(installment_commitment, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(other_parties, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(employment, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lbl_checking_status, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lbl_duration, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lbl_credit_history, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lbl_purpose))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(duration, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(purpose, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(credit_history, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(checking_status, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 106, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(38, 38, 38)
                            .addComponent(lbl_housing)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(housing, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(lbl_existing_credits)
                            .addGap(90, 90, 90)
                            .addComponent(existing_credits, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lbl_foreign_worker)
                            .addComponent(lbl_job)
                            .addComponent(lbl_num_dependents)
                            .addComponent(lbl_own_telephone))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(own_telephone, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(num_dependents, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(foreign_worker, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(job, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lbl_residence_since, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lbl_property_magnitude, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lbl_age, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lbl_other_payment_plans))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(residence_since, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(property_magnitude, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(age, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(other_payment_plants, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(23, 23, 23))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btn_validate)
                .addGap(258, 258, 258))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(checking_status, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_checking_status))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbl_duration)
                            .addComponent(duration, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(9, 9, 9)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(credit_history, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_credit_history))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(purpose, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_purpose))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbl_credit_amount)
                            .addComponent(credit_amount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(saving_status, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_saving_status))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(employment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_employment))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbl_installment_commitment)
                            .addComponent(installment_commitment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(personal_status, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_personal_status))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(other_parties, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_other_parties)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbl_residence_since)
                            .addComponent(residence_since, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbl_property_magnitude)
                            .addComponent(property_magnitude, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(9, 9, 9)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbl_age)
                            .addComponent(age, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(other_payment_plants, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_other_payment_plans))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(housing, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_housing, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbl_existing_credits)
                            .addComponent(existing_credits, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(job, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_job))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbl_num_dependents)
                            .addComponent(num_dependents, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(own_telephone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_own_telephone))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(foreign_worker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_foreign_worker))))
                .addGap(20, 20, 20)
                .addComponent(btn_validate)
                .addContainerGap(19, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void credit_amountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_credit_amountActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_credit_amountActionPerformed

    private void own_telephoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_own_telephoneActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_own_telephoneActionPerformed

    private void btn_validateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_validateActionPerformed
        try {
            this.client = new Client(this.dataSet, this.checking_status.getSelectedItem().toString(), Double.parseDouble(this.duration.getText()), 
                    this.credit_history.getSelectedItem().toString(), this.purpose.getSelectedItem().toString(), 
                    Double.parseDouble(this.credit_amount.getText()), this.saving_status.getSelectedItem().toString(), 
                    this.employment.getSelectedItem().toString(), Double.parseDouble(this.installment_commitment.getText()), 
                    this.personal_status.getSelectedItem().toString(), this.other_parties.getSelectedItem().toString(),
                    Double.parseDouble(this.residence_since.getText()), this.property_magnitude.getSelectedItem().toString(), 
                    Double.parseDouble(this.age.getText()), this.other_payment_plants.getSelectedItem().toString(),
                    this.housing.getSelectedItem().toString(), Double.parseDouble(this.existing_credits.getText()), 
                    this.job.getSelectedItem().toString(), Double.parseDouble(this.num_dependents.getText()),
                    this.own_telephone.getSelectedItem().toString(), this.foreign_worker.getSelectedItem().toString());
            
            System.out.println("Client :: " + this.client.getCurrentInstance().toString());
            
            
                ModelGenerator m_generator = new ModelGenerator();
                m_generator.generateModel();
                
                ModelRequester m_requester = new ModelRequester(m_generator.getcModel(), m_generator.getInstancesSet());
                Instance inst = this.client.getCurrentInstance();
                
                double result = m_requester.requestModelForInstance(inst, this.dataSet);
                String message = (result == 1.0f) ? "Good !" : "Bad !";
                
                JOptionPane.showMessageDialog(this, "This client is " + message);
                
            
            
        } catch (Exception ex) {
            Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btn_validateActionPerformed

    /**
     * @param args the command line arguments
     */
    /*public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        /*try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        /*java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainForm().setVisible(true);
            }
        });
    }*/
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField age;
    private javax.swing.JButton btn_validate;
    private javax.swing.JComboBox checking_status;
    private javax.swing.JTextField credit_amount;
    private javax.swing.JComboBox credit_history;
    private javax.swing.JTextField duration;
    private javax.swing.JComboBox employment;
    private javax.swing.JTextField existing_credits;
    private javax.swing.JComboBox foreign_worker;
    private javax.swing.JComboBox housing;
    private javax.swing.JTextField installment_commitment;
    private javax.swing.JComboBox job;
    private javax.swing.JLabel lbl_age;
    private javax.swing.JLabel lbl_checking_status;
    private javax.swing.JLabel lbl_credit_amount;
    private javax.swing.JLabel lbl_credit_history;
    private javax.swing.JLabel lbl_duration;
    private javax.swing.JLabel lbl_employment;
    private javax.swing.JLabel lbl_existing_credits;
    private javax.swing.JLabel lbl_foreign_worker;
    private javax.swing.JLabel lbl_housing;
    private javax.swing.JLabel lbl_installment_commitment;
    private javax.swing.JLabel lbl_job;
    private javax.swing.JLabel lbl_num_dependents;
    private javax.swing.JLabel lbl_other_parties;
    private javax.swing.JLabel lbl_other_payment_plans;
    private javax.swing.JLabel lbl_own_telephone;
    private javax.swing.JLabel lbl_personal_status;
    private javax.swing.JLabel lbl_property_magnitude;
    private javax.swing.JLabel lbl_purpose;
    private javax.swing.JLabel lbl_residence_since;
    private javax.swing.JLabel lbl_saving_status;
    private javax.swing.JTextField num_dependents;
    private javax.swing.JComboBox other_parties;
    private javax.swing.JComboBox other_payment_plants;
    private javax.swing.JComboBox own_telephone;
    private javax.swing.JComboBox personal_status;
    private javax.swing.JComboBox property_magnitude;
    private javax.swing.JComboBox purpose;
    private javax.swing.JTextField residence_since;
    private javax.swing.JComboBox saving_status;
    // End of variables declaration//GEN-END:variables
}
